﻿using Microsoft.AspNetCore.Mvc;
using SD.Toolkits.AspNetCore.Attributes;
using SlamDunk.MES.IAppService.Interfaces;

namespace SlamDunk.MES.AppService.Host.Controllers
{
    /// <summary>
    /// 编号生成服务WebApi接口
    /// </summary>
    [ApiController]
    [Route("Api/[controller]/[action]")]
    public class NumberController : ControllerBase
    {
        #region # 字段及构造器

        /// <summary>
        /// 编号生成服务契约接口
        /// </summary>
        private readonly INumberContract _numberContract;

        /// <summary>
        /// 依赖注入构造器
        /// </summary>
        public NumberController(INumberContract numberContract)
        {
            this._numberContract = numberContract;
        }

        #endregion

        #region # 生成库存单据编号 —— string GenerateStockOrderNo(string prefix)
        /// <summary>
        /// 生成库存单据编号
        /// </summary>
        /// <param name="prefix">前缀</param>
        /// <returns>单据编号</returns>
        [HttpPost]
        [WrapPostParameters]
        public string GenerateStockOrderNo(string prefix)
        {
            return this._numberContract.GenerateStockOrderNo(prefix);
        }
        #endregion

        #region # 生成生产计划编号 —— string GenerateProductionPlanNo()
        /// <summary>
        /// 生成生产计划编号
        /// </summary>
        /// <returns>生产计划编号</returns>
        [HttpPost]
        [WrapPostParameters]
        public string GenerateProductionPlanNo()
        {
            return this._numberContract.GenerateProductionPlanNo();
        }
        #endregion

        #region # 生成作业计划编号 —— string GenerateExecutionPlanNo()
        /// <summary>
        /// 生成作业计划编号
        /// </summary>
        /// <returns>作业计划编号</returns>
        [HttpPost]
        [WrapPostParameters]
        public string GenerateExecutionPlanNo()
        {
            return this._numberContract.GenerateExecutionPlanNo();
        }
        #endregion

        #region # 生成作业计划质量检查编号 —— string GenerateExecutionPlanInspectionNo()
        /// <summary>
        /// 生成作业计划质量检查编号
        /// </summary>
        /// <returns>作业计划质量检查编号</returns>
        [HttpPost]
        [WrapPostParameters]
        public string GenerateExecutionPlanInspectionNo()
        {
            return this._numberContract.GenerateExecutionPlanInspectionNo();
        }
        #endregion

        #region # 生成工单质量检查编号 —— string GenerateWorkOrderInspectionNo()
        /// <summary>
        /// 生成工单质量检查编号
        /// </summary>
        /// <returns>工单质量检查编号</returns>
        [HttpPost]
        [WrapPostParameters]
        public string GenerateWorkOrderInspectionNo()
        {
            return this._numberContract.GenerateWorkOrderInspectionNo();
        }
        #endregion
    }
}
